package com.punai.standard.controller;

import com.punai.common.core.controller.BaseController;
import com.punai.common.core.page.TableDataInfo;
import com.punai.common.utils.StringUtils;
import com.punai.standard.domain.StaJxFee;
import com.punai.standard.service.IStaJxFeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * 机械费用项Controller
 * 
 * @author zhx
 * @date 2022-12-21
 */
@RestController
@RequestMapping("/sta/jxFee")
public class StaJxFeeController extends BaseController
{
    @Autowired
    private IStaJxFeeService staJxFeeService;

    /**
     * 查询材料费用项列表
     */
    @PreAuthorize("@ss.hasPermi('sta:clFee:list')")
    @GetMapping("/list")
    public TableDataInfo list(StaJxFee staJxFee)
    {
        if (StringUtils.isEmpty(staJxFee.getChapterId())) {
            return getDataTable(new ArrayList<>());
        }
        if (StringUtils.isEmpty(staJxFee.getVersionId())) {
            throw new RuntimeException("版本id为空");
        }
        TableDataInfo tableDataInfo = staJxFeeService.selectStaJxFeeList(staJxFee);
        return tableDataInfo;
    }
}
